package com.suray.wcs.service.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.suray.wcs.service.system.entity.NodeDB;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author cooper
 * @since 2019-06-26
 */
@Repository
public interface NodeDBMapper extends BaseMapper<NodeDB> {
    /**
     * 最大X
     *
     * @return
     */
    Integer getMaxX();

    /**
     * 最大Y
     *
     * @return
     */
    Integer getMaxY();

    /**
     * 最大Z
     *
     * @return
     */
    Integer getMaxZ();

    @Insert("<script>"+ "	insert into wcs_node ( \r\n" +
            "    		 	grid_id, \r\n" +
            "    		 	grid_status, \r\n" +
            "    		 	grid_type, \r\n" +
            "    		 	gridx, \r\n" +
            "    		 	gridy, \r\n" +
            "    		 	gridz, \r\n" +
            "    		 	offsetx, \r\n" +
            "    		 	offsety, \r\n" +
            "    		 	can_to_down, \r\n" +
            "    		 	can_to_left, \r\n" +
            "    		 	can_to_right, \r\n" +
            "    		 	can_to_up, \r\n" +
            "               can_to_stop, \r\n" +
            "    		 	ground_code, \r\n" +
            "    		 	pallet_code, \r\n" +
            "    		 	road_no, \r\n" +
            "    		 	road_type, \r\n" +
            "    		 	single_no, \r\n" +
            "    		 	single_order, \r\n" +
            "    		 	rgv_point, \r\n" +
            "    		 	tag, \r\n" +
            "    		 	direction \r\n" +
            "    		 ) \r\n" +
            "    		 values\r\n" +
            "			<foreach collection=\"list\"  item=\"n\" separator=\",\">\r\n" +
            "\r\n" +
            "    		 	 (\r\n" +
            "    		 		#{n.gridId}, \r\n" +
            "    		 		#{n.gridStatus}, \r\n" +
            "    		 		#{n.gridType}, \r\n" +
            "    		 		#{n.gridx}, \r\n" +
            "    		 		#{n.gridy}, \r\n" +
            "    		 		#{n.gridz}, \r\n" +
            "    		 		#{n.offsetx}, \r\n" +
            "    		 		#{n.offsety}, \r\n" +
            "    		 		#{n.canToDown}, \r\n" +
            "    		 		#{n.canToLeft}, \r\n" +
            "    		 		#{n.canToRight}, \r\n" +
            "    		 		#{n.canToUp}, \r\n" +
            "                   #{n.canToStop}, \r\n" +
            "    		 		#{n.groundCode}, \r\n" +
            "    		 		#{n.palletCode}, \r\n" +
            "    		 		#{n.roadNo}, \r\n" +
            "    		 		#{n.roadType}, \r\n" +
            "    		 		#{n.singleNo}, \r\n" +
            "    		 		#{n.singleOrder}, \r\n" +
            "    		 		#{n.rgvPoint}, \r\n" +
            "    		 		#{n.tag}, \r\n" +
            "    		 		#{n.direction} \r\n" +
            "    		 	 )\r\n" +
            "\r\n" +
            "			</foreach>" + "</script>")
    void saveBatch(List<NodeDB> entityList1);
}
